package task5.chat;

import java.io.*;
import java.net.Socket;

/**
 * 聊天客户端类
 */
public class ChatClient {
    public static void main(String[] args) throws IOException {

        System.out.println("请输入您的名字：");
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String name = bufferedReader.readLine();
        if (name.equals(""))
            return;
        // 定义Socket对象，输入ip和端口号
        Socket socket = new Socket("127.0.0.1",9001);
        // 定义客户端发送和接收线程
        Thread client_send = new Thread(new ClientSend(socket,name));
        Thread client_receive = new Thread(new ClientReceive(socket));
        client_send.start();
        client_receive.start();

    }
}
